home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1994-12-28 | 3.9 KB | 121 lines |
- (* The REAL & LONGREAL functions (PutReal etc) requice 'C' floating point *)
- (* so will not work with the unregisterd version of DICE *)
- (* If you have the registered version of DICE then you must *)
- (* link with the math library, either: *)
- (* m2l x -lm or m2b x -lm , alternatively set -lm in the DCCOPTS env var *)
- (* This is only required if you use the floating point functions: *)
- (* If you only use PutChar etc, you dont need to link the math library *)
-
- DEFINITION MODULE BIO ;
-
- (* Basic I/O system. *)
-
- PROCEDURE PutChar( Ch : CHAR ) ;
- (* Print a character *)
-
- PROCEDURE PutInteger( int : LONGINT ) ;
- (* Print an integer, using the minimum width necessary *)
-
- PROCEDURE PutReal( real : REAL ) ;
- (* Print a real, using the minimum width necessary *)
-
- PROCEDURE PutRealFmt( r : REAL ; width, decplaces : LONGINT ) ;
- (*
- * Prints a real, formatting the value so that it is right justified in
- * a field of the given width, and contains the given number of decimal places.
- *)
-
- PROCEDURE PutLongReal( longreal : LONGREAL ) ;
- (* Print a long real, using the minimum width necessary *)
-
- PROCEDURE PutLongRealFmt( r : LONGREAL; width, decplaces : LONGINT ) ;
- (*
- * Prints a longreal, formatting the value so that it is right justified in
- * a field of the given width, and contains the given number of decimal places.
- *)
-
- PROCEDURE PutString( str : ARRAY OF CHAR ) ;
- (* Print a string, using the minimum width necessary *)
-
- PROCEDURE PutLine( ) ;
- (* Prints a newline character *)
-
- PROCEDURE PutLn( str : ARRAY OF CHAR ) ;
- (* Print a string followed by a newline *)
-
- PROCEDURE GetChar( VAR Ch : CHAR ) ;
- (* Get a character. Unexpected end-of-stream causes a fatal runtime error *)
-
- PROCEDURE GetInteger( VAR int : LONGINT ) ;
- (*
- * Get an integer, first removing leading whitespace.
- * Incorrect input results in a message "Not an INTEGER. Try again".
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE GetReal( VAR real : REAL ) ;
- (*
- * Get a real, first removing leading whitespace.
- * Incorrect input results in a message "Not a REAL. Try again".
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE GetLongReal( VAR longReal : LONGREAL ) ;
- (*
- * Get a longreal, first removing leading whitespace.
- * Incorrect input results in a message "Not a LONGREAL. Try again".
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE GetString( VAR str : ARRAY OF CHAR ) ;
- (*
- * Gets a single WORD, ie. whitespace terminated.
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE GetLn( VAR str : ARRAY OF CHAR ) ;
- (*
- * Gets the entire line (discarding any surplus that doesn't fit into the
- * array). No leading whitespace is skipped, and the trailing newline is
- * discarded rather than stored.
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE GetLine( ) ;
- (*
- * Discard the rest of the current line - including the newline.
- * Unexpected end-of-stream causes a fatal runtime error.
- *)
-
- PROCEDURE IsMore( ) : BOOLEAN ;
- (*
- * Returns: FALSE if the end of the input stream has been reached,
- * TRUE otherwise
- *)
-
- PROCEDURE IsEndOfLine( ) : BOOLEAN ;
- (*
- * Returns: TRUE if the end of the current line has been reached,
- * FALSE otherwise.
- * Warning: even if we return TRUE, the newline character is not removed,
- * so don't forget to discard it with GetLine or GetChar.
- *)
-
- PROCEDURE InspectChar( ) : CHAR ;
- (*
- * Inspect the next character without advancing past it. If we're at the
- * end-of-stream, an undefined character is returned; it is not a fatal
- * runtime error. It is better to check IsMore() before using this.
- *)
-
- PROCEDURE PushBackChar( c : CHAR ) ;
- (*
- * Push back the given character onto the input.
- * Warning: Only one character of pushback is guaranteed.
- *)
-
- PROCEDURE Flush( ) ;
- (* Flush the input and output. Rarely needed. *)
-
- END BIO.
-